import component.Beverage;
import component.concreteComponent.Espresso;
import component.concreteComponent.HouseBlend;
import decorator.concreteDecorator.Milk;
import decorator.concreteDecorator.Sugar;

// 测试类
public class CoffeeShop {
    public static void main(String[] args) {
        // 点一杯浓缩咖啡加牛奶和糖
        Beverage beverage = new Espresso();
        beverage = new Milk(beverage);
        beverage = new Sugar(beverage);

        System.out.println("Description: " + beverage.getDescription());
        System.out.println("Cost: $" + beverage.cost());
        // 输出: Description: Espresso, Milk, Sugar
        // 输出: Cost: $2.29

        beverage = new HouseBlend();
        beverage = new Milk(beverage);
        beverage = new Sugar(beverage);

        System.out.println("Description: " + beverage.getDescription());
        System.out.println("Cost: $" + beverage.cost());
    }
}